package com.taptech.doufu.ui.adapter

import android.content.Context
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.taptech.doufu.R
import com.taptech.doufu.constant.AreaCode
import kotlinx.android.synthetic.main.adapter_area_code.view.*

class AreaCodeAdapter(context:Context):
    BaseRecyclerViewAdapter<AreaCode, AreaCodeAdapter.ViewHolder>(context) {



    override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
        val view = LayoutInflater.from(mContext).inflate(R.layout.adapter_area_code,parent,false)
        return ViewHolder(view)
    }

    override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        super.onBindViewHolder(holder, position)
        val item = dataList[position]
        holder.itemView.tvCountry.text = item.name
        holder.itemView.tvCountryCode.text = "+${item.num}"
    }

    class ViewHolder(view: View) : RecyclerView.ViewHolder(view)

}